import { createRouter, createWebHistory } from 'vue-router'
import MyPage from '@/pages/MyPage.vue'
import HomePage from '@/pages/HomePage.vue'
import UserLoginPage from '@/pages/user/UserLoginPage.vue'
import UserRegisterPage from '@/pages/user/UserRegisterPage.vue'
import UserResetPage from '@/pages/user/UserResetPage.vue'
import TaskAddPage from '@/pages/user/TaskAddPage.vue'
import TaskUpdatePage from '@/pages/user/TaskUpdatePage.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: '主页',
      component: HomePage,
    },
    {
      path: '/my',
      name: '我的',
      component: MyPage,
    },
    {
      path: '/user/login',
      name: '登录',
      component: UserLoginPage,
    },
    {
      path: '/user/register',
      name: '注册',
      component: UserRegisterPage,
    },
    {
      path: '/user/reset',
      name: '忘记密码',
      component: UserResetPage,
    },
    {
      path: '/add_task',
      name: '添加任务',
      component: TaskAddPage,
    },
    {
      path: '/update_task',
      name: '修改任务',
      component: TaskUpdatePage,
    },
    {
      path: '/about',
      name: '关于',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/AboutView.vue'),
    },
  ],
})

export default router
